package main

import (
	"fmt"
	"strings"
)

func main() {
	// 统计一个字符串出现单词的个数
	s := "hello go hello java hello rust 你好"
	split := strings.Split(s, " ")
	m := make(map[string]int, 5)
	for _, s2 := range split {
		_, ok := m[s2]
		if !ok {
			m[s2] = 1
		} else {
			m[s2] = m[s2] + 1
		}
	}
	fmt.Println(m)
}
